package Level02.Four;

public class Test {
    public static void main(String[] args) {
        String str = "  anglebaby   女   18   515151511";
        // 去除字符串两边的空格
        str = str.trim();
        String[] split = str.split("\\s+");
        for (int i = 0; i < split.length; i++) {
            switch (i) {
                case 0:
                    System.out.println("姓名：" + split[i]);
                    break;
                case 1:
                    System.out.println("性别：" + split[i]);
                    break;
                case 2:
                    //把年龄转化为int类型
                    int age = Integer.parseInt(split[i]);
                    System.out.println("年龄：" + age);
                    break;
                case 3:
                    if (split[i].matches("[0-9]{5,12}")) {
                        System.out.println("qq号符合格式：" + split[i]);
                    }else {
                        System.out.println("qq号不符合格式：" + split[i]);
                    }
                    break;
            }

        }

    }
}
